home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / exec / getexeca.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.1 KB  |  56 lines

  1. /*
  2. \funcref{getexecarg}{char $*$getexecarg (\params)}
  3.     {
  4.         {int} {n} {{\em n}-th argument to retrieve}
  5.         {int} {*increment} {address of counter increment}
  6.     }
  7.     {argument in string format}
  8.     {xstrdup(), getarg(), xrealloc()}
  9.     {}
  10.     {getexeca.c}
  11.     {
  12.  
  13.         This function performs a similar function as {\em getarg()} but
  14.         prefixes the retrieved argument with the string {\em arghead} and
  15.         postfixes the argument with the string {\em argtail}. {\bf Note that}
  16.         the return value always points to allocated memory which should be
  17.         freed when no longer required.
  18.  
  19.         See further {\em getarg()}.
  20.  
  21.     }
  22. */
  23.  
  24. #include "icm-exec.h"
  25.  
  26. char *getexecarg (n, flag)
  27. int n;
  28. int *flag;
  29. {
  30.     register char
  31.         *arg,
  32.         *start,
  33.         *ret;
  34.  
  35.     arg = getarg (n, flag);
  36.  
  37.     if (strlen (arghead))
  38.     {
  39.         start = xstrdup (arghead);
  40.         start = xstrcat (start, arg);
  41.         xrealloc (arg, 0);
  42.     }
  43.     else
  44.         start = arg;
  45.  
  46.     if (strlen (argtail))
  47.     {
  48.         ret = xstrcat (start, argtail);
  49.         xrealloc (start, 0);
  50.     }
  51.     else
  52.         ret = start;
  53.  
  54.     return (ret);
  55. }
  56.